#!/bin/bash
clear
########## REMOVENDO ARQUIVOS EXISTENTES ##############
rm criarusuario.sh > /dev/null 2>&1
rm remover.sh > /dev/null 2>&1
rm AlterarSenha.sh > /dev/null 2>&1
rm AlterarData.sh > /dev/null 2>&1
rm KillUser.sh > /dev/null 2>&1
rm sshmonitor.sh > /dev/null 2>&1
rm alterarlimite.sh > /dev/null 2>&1
rm sshlimiter.sh > /dev/null 2>&1
#######################################################
echo "America/Sao_Paulo" > /etc/timezone
ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
rm *.sh > /dev/null 2>&1
wget https://notabug.org/notabugbr/notabugbr1/raw/master/inst/criarusuario.sh > /dev/null 2>&1
wget https://notabug.org/notabugbr/notabugbr1/raw/master/inst/remover.sh > /dev/null 2>&1
wget https://notabug.org/notabugbr/notabugbr1/raw/master/inst/AlterarSenha.sh > /dev/null 2>&1
wget https://notabug.org/notabugbr/notabugbr1/raw/master/inst/AlterarData.sh > /dev/null 2>&1
wget https://notabug.org/notabugbr/notabugbr1/raw/master/inst/KillUser.sh > /dev/null 2>&1
wget https://notabug.org/notabugbr/notabugbr1/raw/master/inst/sshmonitor.sh > /dev/null 2>&1
wget https://notabug.org/notabugbr/notabugbr1/raw/master/inst/alterarlimite.sh > /dev/null 2>&1
chmod 777 *sh
echo -e "\n\033[1;32mAGUARDE...\033[0m"
apt-get install cron -y > /dev/null 2>&1
if [[ "$(grep -c "online.ssh" /etc/crontab)" = "0" ]]; then
echo '* * * * * root /usr/bin/php /var/www/html/pages/system/cron.php' >> /etc/crontab
echo '* * * * * root /usr/bin/php /var/www/html/pages/system/cron.ssh.php ' >> /etc/crontab
echo '* * * * * root /usr/bin/php /var/www/html/pages/system/cron.sms.php' >> /etc/crontab
echo '* * * * * root /usr/bin/php /var/www/html/pages/system/cron.online.ssh.php' >> /etc/crontab
echo '10 * * * * root /usr/bin/php /var/www/html/pages/system/cron.servidor.php' >> /etc/crontab
fi
/etc/init.d/cron reload > /dev/null 2>&1
/etc/init.d/cron restart > /dev/null 2>&1
service ssh restart
cat /dev/null > ~/.bash_history && history -c && clear
echo -e "\033[1;32m COMANDOS CONCLUIDO!\033[0m"
echo -e "\033[0;31m≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠≠\033[0m"
rm inst.sh